package com.test;

public class MFQueuePoolDemo {
	static String queueName = "DEMOQUEUE";
	static String fileBackupPath = "d:/demo";
	static MFQueue queue = null;
	static {
		MFQueuePool.init(fileBackupPath);
		queue = MFQueuePool.getFQueue(queueName);
	}
	
	public static void main(String[] args) {
		test();
		MFQueueAddDemo.test(queue);
		try {
			Thread.sleep(30000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		MFQueueAddDemo.test(queue);
	}
	
	public static void test() {
		for (int i = 0; i < 4; i++) {
			int a = i;
			new Thread(new Runnable() {
				
				@Override
				public void run() {
					while (true) {
						byte[] bytes = queue.poll();
						if (bytes != null) {
							System.out.println("线" + a + "————》" + new String(bytes));
						}
						try {
							Thread.sleep(1000);
						} catch (InterruptedException e) {
							e.printStackTrace();
						}
					}
				}
			}).start();
		}
	}
}
